//package com.example.task;
//
//import cn.hutool.json.JSONUtil;
//import com.alibaba.fastjson.JSONObject;
//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
//import com.example.config.webscoket.WebSocket;
//import com.example.dao.*;
//import com.example.model.entity.*;
//import com.example.model.query.SuppliesRealinfoQuery;
//import com.example.model.query.TEquipmentPartQuery;
//import com.example.model.vo.PocEventVo;
//import com.example.model.vo.SocketVo;
//import com.example.model.vo.SuppliesRealinfoVo;
//import com.example.service.SuppliesRealinfoService;
//import com.example.service.SuppliesService;
//import lombok.extern.slf4j.Slf4j;
//import org.apache.commons.lang3.StringUtils;
//import org.springframework.beans.BeanUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.scheduling.annotation.Scheduled;
//import org.springframework.stereotype.Component;
//import javax.annotation.Resource;
//import java.util.List;
//
//@Component
//@Slf4j
//public class pushTask {
//
//    @Autowired
//    private SuppliesRealinfoService suppliesRealinfoService;
//
//    @Autowired
//    private SuppliesService suppliesService;
//
//    @Resource
//    private WebSocket webSocket;
//
//    @Autowired
//    private SuppliesPropMapper suppliesPropMapper;
//
//    @Autowired
//    private PocEventMapper pocEventMapper;
//
//    @Autowired
//    private TEquipmentPartMapper equipmentPartMapper;
//
//    @Autowired
//    private TEquipmentMapper equipmentMapper;
//
//    @Autowired
//    private TPlanMapper planMapper;
//    @Scheduled(fixedRate = 15000)//15秒
//    public void pushTask() throws Exception {
//        if(webSocket.webSocketSet.size() ==0){
//            return;
//        }
//        //模拟告警
////        QueryWrapper<SuppliesRealinfo> queryWrapper = new QueryWrapper<>();
////        queryWrapper.lambda().eq(SuppliesRealinfo::getIsNew,1L).eq(SuppliesRealinfo::getSuppliesId,"1301481731947991042");
////        SuppliesRealinfo suppliesRealinfo = suppliesRealinfoService.getOne(queryWrapper);
////        if(suppliesRealinfo != null){
////            Supplies supplies = suppliesService.getById(suppliesRealinfo.getSuppliesId());
////            QueryWrapper<SuppliesProp> suppliesPropQueryWrapper = new QueryWrapper<>();
////            suppliesPropQueryWrapper.lambda().eq(SuppliesProp::getIsValid,1L)
////                    .eq(SuppliesProp::getTypeId,supplies.getTypeId());
////            List<SuppliesProp> propList = suppliesPropMapper.selectList(suppliesPropQueryWrapper);
////            String str ="";
////            if(propList.size()>0 ){
////                JSONObject json =JSONObject.parseObject(suppliesRealinfo.getRealInfo());
////                for(SuppliesProp ob : propList){
////                    String propData = json.getString(ob.getPropLabel());
////                    if(StringUtils.isNotBlank(propData)){
////                        String linRead = ob.getPropName()+":"+propData+"\n";
////                        str = str + linRead;
////                    }
////                }
////            }
////            SuppliesRealinfoVo vo= new SuppliesRealinfoVo();
////            BeanUtils.copyProperties(suppliesRealinfo,vo);
////            vo.setRealInfoString(str);
////            vo.setSuppliesName(supplies.getSuppliesName());
////            String besnString = JSONObject.toJSONString(vo);
////            webSocket.GroupSending(besnString);
////            webSocket.GroupSending("test");
//        //模拟事件
////        QueryWrapper<PocEvent> queryWrapper = new QueryWrapper<>();
////        List<PocEvent> pocEventList = pocEventMapper.selectList(queryWrapper);
////        PocEvent pocEvent = pocEventList.get(0);
////        String besnString = JSONObject.toJSONString(pocEvent);
////            webSocket.GroupSending(besnString);
//        TEquipmentPartQuery query = new TEquipmentPartQuery();
//        TEquipmentPart part = equipmentPartMapper.selectById("1343455016436584450");//1343455016436584450，1339828681973669889
////        if(part != null){
////            BeanUtils.copyProperties(part,query);
//            TEquipment equipment = equipmentMapper.selectById(part.getEquipmentId());
//            query.setEquipmentName(equipment.getEquipmentName());
//            TPlan paln = planMapper.selectById("1349283891905294337");
////        }
//
//        SocketVo vo  = new SocketVo();
//        vo.setSource("warning");
//        vo.setType("openVideo");//
//        vo.setData(JSONUtil.parseObj(paln));
//        webSocket.GroupSending(JSONUtil.toJsonStr(vo));
////        PocEvent pocEvent = pocEventMapper.selectById("1351073109312790529");
////        SocketVo vo = new SocketVo();
////        vo.setSource("event");
////        vo.setType("add");
////        vo.setData(JSONUtil.parseObj(pocEvent));
////        webSocket.GroupSending(JSONUtil.toJsonStr(vo));
//    }
//}
//
